import React from 'react'
import {User} from "./searchPanel"

interface Project{
    id: string,
    name: string,
    personId:string,
}

interface ListProps{
    users:User[],
    list:Project[]
}
export function List({users, list}:ListProps) {
    //console.log('list',users);
    //console.log('2',list);
  return (
    <table>
        <thead>
            <th>名称</th>
            <th>负责人</th>
        </thead>
        <tbody>
            {
                list.map(project=>
                <tr key={project.id}>
                    <td>{project.name}</td>
                    <td>{users.find(user=>user.id===project.personId)?.name||'未知'}</td>
                </tr>)
            }
        </tbody>
    </table>
  )
}
